import React from 'react';
import {View, Navigator, Text, Block} from '@tarojs/components'
import './cinema.scss'

const Cinema: React.FC<{ data: any; go: number }> = (props) => {
  return (
    <View className='cinemaBox'>
      {props.data && props.data.length > 0 && props.data.map((item, index) =>
        <Navigator className='cinema__item' key={index}
          url={props.go ? '/movie/Cinfo?id=' + item.out_id + '&mid=' + props.go : '/movie/Cinfo?id=' + item.out_id}
        >
          <View className='cinema__name'><Text className='text'>{item.name}</Text><Text
            className='juli'
          >{item.distance > 100 ? ">100" : item.distance}km</Text></View>
          <View className='cinema__info'>
            {item.price && item.price !== "无排期" &&
              <View className='cinema__price'>￥{item.price}<Text>起</Text></View>}
            <View className='cinema__label'>
              {item.labels && item.labels.length > 0 && item.labels.map((v, i) =>
                <Block key={i}>
                  <Text className={`lable1 lables ${process.env.TARO_ENV}`}>{v}</Text>
                </Block>
              )}
            </View>
          </View>
        </Navigator>
      )}
    </View>
  )
}

Cinema.defaultProps = {
  data: [],
  go: 0
}

export default Cinema
